﻿<?php
require_once(dirname(__FILE__)."/../../libs/login/login.php"); 
require_once(dirname(__FILE__)."/../../libs/dbclass/dbconnect.php");
require_once(dirname(__FILE__)."/../../libs/string/libstr.php");
require_once(dirname(__FILE__)."/../../admin/libs/config_class.php");
$lg=new login();
$lg->checklogin("admin_member");//检验是否登录
$mc=new libstr();
$cf=new config();
$id=$_GET["id"];
if(!$mc->isnum($id)){
	$mc->msg("参数错误");
}
$condition=" where id='".$id."' ";
$info=$cf->getInfo("friendly_link",$condition);
//更新
if ($mc->Ismp($_POST["Submit"])!=""){
		
	//if ($_POST["files"]==""){$mc->msg("请选择要上传的图片","link_content_add.php");}
	$data=array();
	$id=$mc->request("id","");
	$data['webname']=$mc->request("webname","");
	$data['files']=$mc->request("files","");
	$data['url']=$mc->request("url","");
	$data['isshow']=$mc->request("isshow","");
	$data['classorder']=$mc->request("classorder","");
	$data['createtime']=date('Y-m-d H:i:s');
	$condition=" id='".$id."' ";
	$db->update_data("friendly_link",$data,$condition);
	$mc->msg("编辑成功","link_content.php");	
}
$path="编辑友情链接";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理系统</title>
<link rel="stylesheet" type="text/css" href="../../plug/swfupload/uploadify.css">
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<!--产品图片css!-->
	<style>
.imgall{position: relative; width:100px; height:100px; float:left; margin-right:10px}

.imgall img{  }
.imgall span{ position:absolute; width:100px; height:32px;bottom:0px; display:none; }
.imgall:hover span{display:block;}
.imgall span input{float:right; cursor:pointer; background-image: url(../images/trash-alt-empty-32.png); width:32px; height:32px; border:0; }
</style>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/upload.js"></script>
<script type="text/javascript" src="../../plug/swfupload/jquery.min.js"></script>
<script type="text/javascript" src="../../plug/swfupload/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript">
	  //图片上传
	$(document).ready(function() {
        $('#file_upload').uploadify({
            'onSelect' :function(){shows3();},
			'onUploadSuccess' : function(file, data, response) {  
 		    // alert(data);
			  var board=document.getElementById("files");
			  	 $("#allpics").html("<div class='imgall'><img src='"+data+"' height='90' /><span><input type='button' title='删除'></span></div>");
			      board.value=data;
			  
			  
//成功后加载	删除修改图片代码		  
	$(".imgall input").each(function(i){
		$(this).click(function(){
			$(this).parent().parent().remove();
			var im="";
			$(".imgall").each(function(index){
				
				if(im==""){
					im=$(".imgall img:eq("+index+")").attr('src');
					}else{
					im+=","+$(".imgall img:eq("+index+")").attr('src');	
						}
				})
			  board.value=im;
			  if(im==""){
			  	 $("#allpics").html('<img src="../../plug/swfupload/moren.jpg"  height="90px" >');//如果为空，显示默认的图片
			  }
			})
		
		})
      
            }, 	

		  'onUploadStart' : function(file) {
		  $("#file_upload").uploadify("settings","formData",{"pic1":$("#aaa").val()});
		  },	
		  
		  'removeTimeout':'4',//进度条消失时间
		  'method'   : 'post',
		  'buttonImage':'','height': '30',
		  'width': '75',
		  'queueID' : 'some_file_queue',
		  'displayData'    : 'percentage',
		  'fileTypeExts'     : '*.jpg;*.jpeg;*.png;*.gif;*.bmp',
		  'fileTypeDesc'    : '支持的格式(.JPG,.JPEG,.PNG,.GIF)',//允许的格式
		  'fileSizeLimit':'100024KB',//上传文件大小限制
		  'queueSizeLimit':'1',//同时上传的文件最大数
		  //'auto':false,//是否选取文件后自动上传
		  'swf' : '../../plug/swfupload/uploadify.swf?ver='+ Math.random(),//是组件自带的flash，用于打开选取本地文件的按钮 
		  'uploader' : '../../plug/swfupload/poster.php?type=4',
		  'buttonText': '上传图片'
		   
		  // Your options here
	  });
  });	
  //$('#file_upload').uploadify('upload','*')//控制文件上传		
</script>
</head>
<body style="background:#fff"> 
<div class="content">
    <div class="right">
<form name="form1" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td width="100%" height="24" class="top_head">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="1%" align="right"  height="45">&nbsp;</td>
                <td width="99%" >
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="55%" style="padding-left:20px;padding-top:10px;"><img src="../images/head.gif" width="13" height="11"><b><?php echo $path;?></b><a href="img_content.php" style=" margin-left:20px; text-decoration:underline;">返回列表</a></td>
                    <td width="45%" align="right">&nbsp;</td>
                  </tr>
                </table>
                </td>
              </tr>
            </table>
        </td>
      </tr>
</table>
   
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="liebiao">
  <tr>
    <td width="11%" height="50" align="right">名称：</td>
    <td height="50"><input name="webname" type="text" id="webname"  value="<?php echo $info["webname"];?>" ><Font>
   </Font></td>
    </tr>
  <tr>
    <td height="50" align="right" valign="middle">链接：</td>
    <td height="50" valign="middle"><input name="url" type="text" id="url" value="<?php echo $info["url"];?>"><Font>
   </Font></td>
    </tr>
      <tr>
    <td height="50" align="right" valign="middle">上传LOGO：</td>
    <td height="50" valign="middle"><input name="files" type="text" id="files" value="<?php echo $info["files"];?>"><div class="anniu"><input type="file" name="file_upload" id="file_upload"  /></div><Font>
   </Font></td>
    </tr>
        <td height="50" align="right" valign="middle">图片预览：</td>
    <td height="50" valign="middle"><div id="allpics"><?php if($info["files"]==""){?><img src="../../plug/swfupload/moren.jpg"  height="90px" ><?php }else{?><img src="<?php echo $info["files"];?>" height="90px"><?php }?></div></td><!-- 预览的图片!-->
    </tr>
       <tr>
    <td height="50" align="right" valign="middle">是否可见：</td>
    <td height="50" valign="middle">
        <div  class="ziyuan">
            <select name="isshow"  id="isshow"><option value="1" <?php if($info["isshow"]==1){?>selected<?php }?>>可见</option><option value="0" <?php if($info["isshow"]==0){?>selected<?php }?>>隐藏</option></select><Font>
        </div>
       </Font>
   </td>
    </tr>
     <tr>
    <td height="50" align="right" valign="middle">排序：</td>
    <td height="50" valign="middle"><input name="classorder" type="text" id="classorder" value="<?php echo $info["classorder"];?>"><Font>
   </Font></td>
    </tr>
  <tr>
    <td height="50" align="right" valign="middle">&nbsp;</td>
    <td height="50" valign="middle"><bdo>
     <input type="hidden" name="id" value="<?php echo $id?>">
      <input type="submit" name="Submit" value="提交"> <input type="button" name="button" value="返回" onClick="location.href='img_content.php'">
    </bdo></td>
    </tr>
    </table>
</form>
</div>
</div>
</body>
</html>
